{extend name="./app/admin/view/main.html" /}
{block name="title"}推送设置 - {__block__}{/block}
{block name="style"}
<style>
</style>
{/block}

{block name="main"}
 <header class="mipcms-container-header">
     <div class="float-left header-group">
        <h4 class="title">系统</h4> <h5 class="sub-title">推送设置</h5>
    </div>
    <button type="button" class="pull-right ivu-btn ivu-btn-primary ivu-btn-circle" @click='onSubmitSetting'>
        <span>立即保存</span>
    </button>
</header>

<main class="mipcms-container-body" style="height: calc(100% - 50px)">

<section class="mip-box">
    <section class="mip-box-heading">
        <h3>MIP推送</h3>
    </section>
    <section class="mip-box-body">
        <i-form label-position="top">
            <div class="row">
                <div class="col-md-6">
                    <Form-item label="MIP引入提交接口">
                        <i-input v-model="setting.mipApiAddress" placeholder="请到百度站长平台 移动专区->MIP引入 获取（M域名）"></i-input>
                    </Form-item>
                </div>
                <div class="col-md-2">
                     <Form-item label="MIP自动推送">
                        <i-switch v-model="setting.mipPostStatus">
                            <span slot="open">开</span>
                            <span slot="close">关</span>
                        </i-switch>
                    </Form-item>
                </div>
            </div>
          
        </i-form>
    </section>
</section>

<section class="mip-box">
    <section class="mip-box-heading">
        <label style="color: red">*必填</label>
        <h3>熊掌号</h3>
    </section>
    <section class="mip-box-body">
        <i-form label-position="top">
            <div class="row">
                <div class="col-md-6">
                    <Form-item label="熊掌号ID">
                        <i-input v-model="setting.guanfanghaoCambrian"></i-input>
                    </Form-item>
                    <Form-item label="熊掌号新增接口">
                        <i-input v-model="setting.guanfanghaoRealtimeUrl"></i-input>
                    </Form-item>
                    <Form-item label="熊掌号历史接口">
                        <i-input v-model="setting.guanfanghaoUrl"></i-input>
                    </Form-item>
                </div>
                <div class="col-md-2">
                     <Form-item label="熊掌号模式">
                        <i-switch v-model="setting.guanfanghaoStatus">
                            <span slot="open">开</span>
                            <span slot="close">关</span>
                        </i-switch>
                    </Form-item>
                    <Form-item label="熊掌号自动推送">
                        <i-switch v-model="setting.guanfanghaoStatusPost">
                            <span slot="open">开</span>
                            <span slot="close">关</span>
                        </i-switch>
                    </Form-item>
                </div>
            </div>
        </i-form>
    </section>
</section>

<section class="mip-box">
    <section class="mip-box-heading">
        <h3>原创推送</h3>
    </section>
    <section class="mip-box-body">
        <i-form label-position="top">
            <div class="row">
                <div class="col-md-6">
                    <Form-item label="原创提交接口">
                        <i-input v-model="setting.baiduYuanChuangUrl"></i-input>
                    </Form-item>
                </div>
                <div class="col-md-2">
                   <Form-item label="原创自动推送">
                        <i-switch v-model="setting.baiduYuanChuangStatus">
                            <span slot="open">开</span>
                            <span slot="close">关</span>
                        </i-switch>
                    </Form-item>
                </div>
            </div>
        </i-form>
    </section>
</section>


<section class="mip-box">
    <section class="mip-box-heading">
        <h3>链接推送</h3>
    </section>
    <!-- 链接提交 -->
    <section class="mip-box-body">
        <i-form label-position="top">
            <div class="row">
                <div class="col-md-6">
                    <Form-item label="链接提交接口">
                        <i-input v-model="setting.baiduTimePcUrl"></i-input>
                    </Form-item>
                </div>
                <div class="col-md-2">
                   <Form-item label="链接自动推送">
                        <i-switch v-model="setting.baiduTimePcStatus">
                            <span slot="open">开</span>
                            <span slot="close">关</span>
                        </i-switch>
                    </Form-item>
                </div>
            </div>
        </i-form>
    </section>

    <!-- 推送频率设置 -->
    <section class="mip-box-body">
        <i-form label-position="top">
            <div class="row">
                <div class="col-md-6">
                    <Form-item label=" 推送频率设置">
                        <i-input v-model="setting.baiduTimePcUrl"></i-input>
                    </Form-item>
                </div>
                <div class="col-md-2">
                   <Form-item label="推送频率开关">
                        <i-switch v-model="setting.baiduTimePcStatus1">
                            <span slot="open">开</span>
                            <span slot="close">关</span>
                        </i-switch>
                    </Form-item>
                </div>
            </div>
        </i-form>
    </section>

    <!-- 推送量设置 -->
    <section class="mip-box-body">
        <i-form label-position="top">
            <div class="row">
                <div class="col-md-6">
                    <Form-item label="推送量设置">
                        <i-input v-model="setting.baiduTimePcUrl"></i-input>
                    </Form-item>
                </div>
                <div class="col-md-2">
                   <Form-item label="推送量设置开关">
                        <i-switch v-model="setting.baiduTimePcStatus2">
                            <span slot="open">开</span>
                            <span slot="close">关</span>
                        </i-switch>
                    </Form-item>
                </div>
            </div>
        </i-form>
    </section>

    <!-- 百度站长token -->
    <section class="mip-box-body">
            <i-form label-position="top">
                <div class="row">
                    <div class="col-md-6">
                        <Form-item label="百度站长token">
                            <i-input v-model="setting.baiduTimePcUrl"></i-input>
                        </Form-item>
                    </div>
                </div>
            </i-form>
    </section>

</section>

<!-- 废弃 -->
<!-- <section class="mip-box">
    <section class="mip-box-heading">
        <h3>百度站内搜索</h3>
    </section>
    <section class="mip-box-body">
        <i-form label-position="top">
            <div class="row">
                <div class="col-md-6">
                    <Form-item label="百度站内搜索Key">
                        <i-input v-model="setting.biaduZn"></i-input>
                    </Form-item>
                    <Form-item label="百度站内搜索sitemap">
                        <i-input v-model="setting.baiduSearchPcUrl"></i-input>
                    </Form-item>
                </div>
                <div class="col-md-6">
                </div>
            </div>
        </i-form>
    </section>
</section> -->
</main>
{/block}
    
{block name="javascript"}
{__block__}
<script>
    new Vue({
        el: '#app',
        data: {
            setting: '',
        },
        watch: {
        },
        mounted() {
            this.getSettingData();
        },
        methods: {
            onSubmitSetting: function() {
                var _this = this;
                if(!this.setting.guanfanghaoCambrian){ 
                    alert('熊掌号不能为空');
                    return false;
                }
                this.$mip.ajax('{$domain}/setting/ApiAdminSetting/settingEdit', {
                    setting: JSON.stringify(this.setting),
                }).then(function(res) {
                    if(res.code == 1) {
                        _this.$Message.success('保存成功');
                        _this.getSettingData();
                    }
                });
            },
            getSettingData: function() {
                var _this = this;
                this.loading = true;
                this.$mip.ajax('{$domain}/setting/ApiAdminSetting/settingSelect', {

                }).then(function(res) {
                    _this.loading = false;
                    if(res.code == 1) {
                        var temp = res.data;
                        if(temp.systemStatus) {
                            temp.systemStatus = true;
                        } else {
                            temp.systemStatus = false;
                        }
                        if(temp.loginStatus) {
                            temp.loginStatus = true;
                        } else {
                            temp.loginStatus = false;
                        }
                        if(temp.registerStatus) {
                            temp.registerStatus = true;
                        } else {
                            temp.registerStatus = false;
                        }
                        if(temp.idStatus) {
                            temp.idStatus = true;
                        } else {
                            temp.idStatus = false;
                        }
                        if(temp.codeCompression) {
                            temp.codeCompression = true;
                        } else {
                            temp.codeCompression = false;
                        }
                        if(temp.baiduSpider) {
                            temp.baiduSpider = true;
                        } else {
                            temp.baiduSpider = false;
                        }
                        if(temp.articlePages) {
                            temp.articlePages = true;
                        } else {
                            temp.articlePages = false;
                        }
                        if(temp.mipPostStatus) {
                            temp.mipPostStatus = true;
                        } else {
                            temp.mipPostStatus = false;
                        }
                        if(temp.baiduYuanChuangStatus) {
                            temp.baiduYuanChuangStatus = true;
                        } else {
                            temp.baiduYuanChuangStatus = false;
                        }
                        if(temp.guanfanghaoStatus) {
                            temp.guanfanghaoStatus = true;
                        } else {
                            temp.guanfanghaoStatus = false;
                        }
                        if(temp.guanfanghaoStatusPost) {
                            temp.guanfanghaoStatusPost = true;
                        } else {
                            temp.guanfanghaoStatusPost = false;
                        }

                        if(temp.baiduTimePcStatus) {
                            temp.baiduTimePcStatus = true;
                        } else {
                            temp.baiduTimePcStatus = false;
                        }
                        if(temp.baiduTimeMStatus) {
                            temp.baiduTimeMStatus = true;
                        } else {
                            temp.baiduTimeMStatus = false;
                        }
                        if(temp.diyUrlStatus) {
                            temp.diyUrlStatus = true;
                        } else {
                            temp.diyUrlStatus = false;
                        }
                        if(temp.urlCategory) {
                            temp.urlCategory = true;
                        } else {
                            temp.urlCategory = false;
                        }

                        if(temp.aritcleLevelRemove) {
                            temp.aritcleLevelRemove = true;
                        } else {
                            temp.aritcleLevelRemove = false;
                        }

                        if(temp.superSites) {
                            temp.superSites = true;
                        } else {
                            temp.superSites = false;
                        }

                        if(temp.rewrite) {
                            temp.rewrite = true;
                        } else {
                            temp.rewrite = false;
                        }
                        temp.baiduSearchPcUrl = '{$domain}' + '/baiduSitemapPc.xml';
                        temp.baiduSearchMUrl = '{$domain}' + '/baiduSitemapMobile.xml';
                        _this.setting = temp;
                    }
                });
            },

        }
    })
  </script>
{/block}